using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class FormulaMap : EntityTypeConfiguration<Formula>
	{
		public FormulaMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.FormulaName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.FormulaTemplate)
				.HasMaxLength(500);
				
			// Table & Column Mappings
			this.ToTable("Formula");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.FormulaName).HasColumnName("FormulaName");
			this.Property(t => t.FormulaTemplate).HasColumnName("FormulaTemplate");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
			this.Property(t => t.CreateBy).HasColumnName("CreateBy");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.CreateStationID).HasColumnName("CreateStationID");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStationID).HasColumnName("UpdateStationID");
		}
	}
}

